package com.antis.olsl.data.stock.detail;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.antis.olsl.arouterlib.DataRoutePath;
import com.antis.olsl.base.BaseActivity;
import com.antis.olsl.data.databinding.ActivityBrandDetailBinding;
import com.antis.olsl.data.response.GetBrandInventoryDetailResp;
import com.trello.rxlifecycle2.LifecycleTransformer;

import java.util.HashMap;
import java.util.Map;

@Route(path = DataRoutePath.ACTIVITY_BRAND_DETAIL)
public class BrandDetailActivity extends BaseActivity<ActivityBrandDetailBinding> implements BrandDetailContract.View {
    @Autowired
    String brandCode;

    private BrandDetailPresenter mPresenter;

    @Override
    protected ActivityBrandDetailBinding getViewBinding() {
        return ActivityBrandDetailBinding.inflate(getLayoutInflater(), baseBinding.getRoot(), true);
    }

    @Override
    protected void initPresenter() {
        super.initPresenter();
        mPresenter = new BrandDetailPresenter();
        mPresenter.takeView(this);
    }

    @Override
    protected void initViews() {
        ARouter.getInstance().inject(this);
    }

    @Override
    protected void initData() throws IllegalAccessException {
        Map<String, Object> map = new HashMap<>();
        map.put("brandCode", brandCode);
        mPresenter.getBrandInventoryDetail(map);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (null != mPresenter) {
            mPresenter.unSubscribe();
        }
    }

    @Override
    public void getBrandInventoryDetailSuccess(GetBrandInventoryDetailResp.ContentBean bean) {

    }

    @Override
    public void getBrandInventoryDetailFailure(String msg) {

    }

    @Override
    public boolean isActive() {
        return false;
    }

    @Override
    public <T> LifecycleTransformer<T> bindToLife() {
        return this.bindToLifecycle();
    }
}